<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>广西水利电力职业技术学院 | 教务系统</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

</head>

<body class="gray-bg">

<?php
/**
 * Created by PhpStorm.
 * User: Mak
 * Date: 2016/1/27
 * Time: 17:44
 */

//header("content-type:text/html; charset=utf-8");
include "Snoopy.class.php";
$sn=new Snoopy;

$sn->proxy_host="1.193.163.32";
$sn->proxy_port="8080";

$url="http://jw.gxsdxy.cn/jiaowures/Login.aspx";

$sn->fetch($url);
$jw=$sn->results;

$pattern = '/<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.*?)" \/>/is';
preg_match_all($pattern, $jw, $matches);
$res[0] = $matches[1][0];
$pattern = '/<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.*?)" \/>/is';
preg_match_all($pattern, $jw, $matches);
$res[1] = $matches[1][0];

$c=$sn->headers[6];
preg_match_all('|Set-Cookie: ASP.NET_SessionId=(.*);|U',$c,$mycookie);
//print_r($mycookie);

$sn2=new Snoopy;
$sn2->cookies['ASP.NET_SessionId']=$mycookie[1][0];
//print_r($mycookie);
$sn2->agent="Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko";
//$sn->referer="http://jw.gxsdxy.cn/jiaowu/";
$sn2->rawheaders['Pragma']='no-cache';
$sn2->fetch("http://jw.gxsdxy.cn/jiaowures/other/CheckCode.aspx?datetime=az");
$verifyjpg = time();
echo $sn2->results;
file_put_contents("{$verifyjpg}.jpg",$sn2->results);

?>

    <div class="middle-box text-center loginscreen animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name"> <img src="img/sd.png" width="200px"> </h1>

            </div>
            <h3>广西水利电力职业技术学院</h3>
            <p>本网站由信息工程系敏捷软件协会开发，现仅支持查询成绩，如果大家喜欢，后期会增加其他功能。本站兼容手机电脑各种浏览器。无需担心浏览器问题。<br> 有问题可通过微信公众号反馈给我们<br>（微信公众号：mjrjxh）
                <!--Continually expanded and constantly improved Inspinia Admin Them (IN+)-->
            </p>
            <p>登录教务系统</p>
            <form class="m-t" role="form" action="login.php" method="post">
                <input type="hidden" name="__VIEWSTATE" value="<?php echo $res[0];?>">
                <input type="hidden" name="__EVENTVALIDATION" value="<?php echo $res[1];?>">
                <input type="hidden" name="img" value="<?php echo $verifyjpg;?>">
                <input type="hidden" name="Cookie" value="<?php echo $mycookie[1][0];?>">
                <div class="form-group">
                    <input type="text" name="Account" class="form-control" placeholder="你的学号" required="">
                </div>
                <div class="form-group">
                    <input type="password" name="PWD" class="form-control" placeholder="你的密码" required="">
                </div>
                <div class="form-group">
                    <input type="text" name="CheckCode" class="form-control" placeholder="验证码" required="">

                </div>
                <div class="form-group">
                    <img src="<?php echo $verifyjpg;?>.jpg" width="100px" height="35px">
                </div>
                <button type="submit" class="btn btn-primary block full-width m-b">登录</button>
            </form>
            <p class="m-t"> <small>信息工程系敏捷软件协会 by Mak &copy; 2016</small> </p>
        </div>
    </div>

    <!-- Mainly scripts -->
    <script src="js/jquery-2.1.1.js"></script>
    <script src="js/bootstrap.min.js"></script>

</body>

</html>
